#include "previewer_widget.h"
#include "ui_previewer.h"
#include <qpushbutton.h>
#include <iostream>
#include <QMetaObject>
#include <QMutex>
#include <QQueue>
#include "camera_previewer_widget.h"
#include "desktop_previewer_widget.h"
#include "player_widget.h"

//#define USE_D3D
#define USE_DXVA
//#define USE_DEFAULT

PreviewerWidget::PreviewerWidget(QWidget* parent) :
    QWidget(parent),
    ui(new Ui::PreviewerWidget)
{
    ui->setupUi(this);
    this->init_ctrl();
}

PreviewerWidget::~PreviewerWidget()
{
    delete ui;
}

void PreviewerWidget::init_ctrl()
{
    ui->verticalLayout->setContentsMargins(0, 0, 0, 0);

    auto camera_widget = new CameraPreviewerWidget(this);
    auto desktop_widget = new DesktopPreviewerWidget(this);
    auto player_widget = new PlayerWidget(this);

    ui->tabWidget->addTab(player_widget, u8"播放器");
    ui->tabWidget->addTab(camera_widget, u8"摄像头预览");
    ui->tabWidget->addTab(desktop_widget, u8"桌面预览");

    ui->tabWidget->setCurrentIndex(2);
}

void PreviewerWidget::paintEvent(QPaintEvent*)
{
}
